var Toiletoperation = {};

Toiletoperation.init = function()
{
}

Toiletoperation.tunXi = function()
{

}

public int getRegisterValue(int slaveAddr, int regAddr) {
    return slaver.getRegister(regAddr);
}

public int getRegisterBitValue(int slaveAddr, int regAddr, int bit) {
    int v = (int) (1 << bit);
    int reg = slaver.getRegister(regAddr);
    if ((reg & v) == v)
        return 1;
    else
        return 0;
}

public int getRegisterHighValue(int slaveAddr, int regAddr) {
    int reg = slaver.getRegister(regAddr);
    return (reg & 0xff00) >> 8;
}

//读取马桶8-11位的值
public int getRegister4HighValuebefore(int slaveAddr, int regAddr) {
    int reg = slaver.getRegister(regAddr);
    return (reg & 0x0f00) >> 8;
}

//读取马桶12-15位的值
public int getRegister4HighValue(int slaveAddr, int regAddr) {
    int reg = slaver.getRegister(regAddr);
    return (reg & 0xf000) >> 12;
}

//读取马桶1-3位的值
public int getRegister4LowValuebefore(int slaveAddr, int regAddr) {
    int reg = slaver.getRegister(regAddr);
    return (reg & 0x000f);
}

//读取马桶4-7位的值
public int getRegister4LowValue(int slaveAddr, int regAddr) {
    int reg = slaver.getRegister(regAddr);
    return (reg & 0x00f0) >> 4;
}

public int getRegisterLowValue(int slaveAddr, int regAddr) {
    int reg = slaver.getRegister(regAddr);
    return (reg & 0x00ff);
}